<?php
class FooterForm extends Form{
	function FooterForm(){
		Form::Form('FooterForm');
	}
	
	function draw(){
		global $display;
			
		$display->add('url_home',WEB_DIR);
		
		$footer_content = html_entity_decode(@CGlobal::$configs['footer_content']['conf_val'], ENT_QUOTES, "UTF-8");

		if($footer_content!='')
		$display->add("footer_content",$footer_content);
		
		if(User::is_admin())
		$display->add("edit_link",Url::open_popup(Url::build('footer_edit'),800,600,false,false,false,false,false,1,1));
		
		$display->add("web_dir",WEB_DIR);
		
		$total		= (int)DB::fetch('SELECT count(*) as total FROM '._SESS_TABLE.' WHERE session_expires >'.( TIME_NOW - 900 ),'total',1);
		$mem		= (int)DB::fetch('SELECT count(total) as total FROM ( SELECT count(user_id) as total FROM '._SESS_TABLE.' WHERE session_expires >'.( TIME_NOW - 900 ).' AND user_id !=0 GROUP BY user_id) as t','total',1);
		$guest		= (int)($total - $mem);
		
		$display->add("FOOTER_CONTENT",	FOOTER_CONTENT);
		
		$display->add("is_admin",	User::is_admin());
		
		$display->add("online",		number_format($total,null,null,'.'));
		$display->add("mem",		number_format($mem,null,null,'.'));
		$display->add("guest",		number_format($guest,null,null,'.'));
		
		$display->add("site_hit",		(int)User::$site_hit);
		$display->add("site_hit_day",	(int)User::$site_hit_day);
		
		$display->output("Footer");
	}
}
?>